#ifndef ACTION_H
#define ACTION_H
#include "protocol.h"
#include <QTextEdit>
#include "dateedit.h"
class Action : public DocEntity
{
    Q_OBJECT
public:
    Action(Protocol* parent);
    QWidget* view(ViewTypes viewType=Normal);
    void giveBithTo();
    QString content() const;
    QDate expiry() const;
    void refresh(const RefreshType &refreshType);
    void setNote(const QString&note);
    bool saveToDB();
    bool isCompleted();
    bool isPerformed();
    bool isDelinquent();
    bool isEdited();
protected:
    QString capTemplate();
    bool removeFromDB();
    bool isCorrect();
private:
    struct CEO
    {
        QString content;
        QString expiry;
        QString opinion;
    };
    QString m_content;
    QDate m_expiry;
    QList<int> m_performers;    
    QMap <int, CEO> m_info;
    QTabWidget* m_tab;
    QWidget* tabPage(QWidget* Parent, QTextEdit* content, DateEdit* date, QTextEdit* opinion);
public slots:
    void setContent(const QString&Content);
    void setExpiry(const QDate& date);
    void appendPerformer(const int&ID);
    void approve();
    void finished();
    void newProtocol();
private slots:
    void changePerformer(const int&view, const int&ID);
    void performersCountChange(const int&count);
    void ordersView();
    void appendOrder();
};

#endif // ACTION_H
